import { NestFactory } from '@nestjs/core';
import { RootModule } from './rootModule';
import { GlobalExceptionFilter } from './common/interceptor/interceptor';
import { ResponseInterceptor } from './common/interceptor/interceptor';

async function startService() {
  const app = await NestFactory.create(RootModule);
  //拦截器
  app.useGlobalInterceptors(new ResponseInterceptor());
  //异常控制器
  app.useGlobalFilters(new GlobalExceptionFilter());
  await app.listen(process.env.PORT ?? 3000);
}
startService();
